package chou_hong_bao;

import java.util.Random;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Test04 {
    //抢红包：
    /*
    假设：100元红包，3个红包，五个人去抢
    其中红包是共享数据
    线程：5个
    打印：***抢到了***元
         ***抢到了***元
         ***抢到了***元
         ***没抢到
         ***没抢到
    */

    public static void main(String[] args) {
        //创建三个红包
        MyThread redPacket = new MyThread();
        Thread t1 = new Thread(redPacket,"帅哥");
        Thread t2 = new Thread(redPacket,"丑的");
        Thread t3 = new Thread(redPacket,"不丑的");
        Thread t4 = new Thread(redPacket,"不帅的");
        Thread t5 = new Thread(redPacket,"美的");

        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}
